<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib tagdir="/WEB-INF/tags/ryctag/" prefix="ryctag"%>
<%@ taglib uri='/WEB-INF/tags/ryc.tld' prefix='ryc'%>
<%@ page import = "timesheet.model.*"%>
<%@ page import = "java.util.*"%>
<%@ page import = "org.json.JSONArray"%>
<%@ page import = "org.json.JSONObject"%>
<html>
<head>
	<% Boolean logged = (Boolean)session.getAttribute("LOGGED"); %>
	<% Boolean startday = (Boolean)session.getAttribute("STARTDAY"); %>
	<% Boolean stopday = (Boolean)session.getAttribute("STOPDAY"); %>
    <title>Time sheet</title>
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
	<link rel='stylesheet' type='text/css' href='/css/dhtmlxscheduler.css'>
	<link rel="stylesheet" type="text/css" href="/css/jquery-ui-1.8.24.custom.css" />
	<link rel="stylesheet" type="text/css" href="/css/style.css" />
    <script src='/js/dhtmlxscheduler.js' type="text/javascript" charset="utf-8"></script>
	<script src='/js/dhtmlxscheduler_timeline.js' type="text/javascript" charset="utf-8"></script>
	<script src='/js/dhtmlxscheduler_tooltip.js' type="text/javascript" charset="utf-8"></script>
	<script src="/js/jquery-1.8.2.min.js"></script>
	<!-- !!! Be careful if you want to migrate to the jquery-1.9.2 version because it would break the tabs see this page (where jQueryUI committers fight with the users) -> http://bugs.jqueryui.com/ticket/7822 -->
    <script src="/js/jquery-ui-1.8.24.custom.min.js"></script> <%-- Jquery plugin who add libraries for UI but need JQuery dore --%>
    <script src='/js/script.js' type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
   	$(function() {
     	$('#filterprojecttooltip').hide();
     	$('#filterusertooltip').hide();
    });
    $(function() {
        $('#userbutton').click(function(){
        	$('#filterusertooltip').toggle("slow");
        });
    });
    </script>
    <script type="text/javascript">
    $(function() {
        $('#projectbutton').click(function(){
        	$('#filterprojecttooltip').toggle("slow");
        });
    });
    </script>
    <script type="text/javascript">
    $(function() {
		if(!${ok2}&&!${ok3}&&!${ok4}){
			$("#tabs").tabs();
		}
		else{
			if(${ok2}){
				$("#tabs").tabs({selected : 1});
			}
			else{
				if(${ok3}){
					$("#tabs").tabs({selected : 2});
				}		
				else{
					if(${ok4}){
						$("#tabs").tabs({selected : 3});
					}	
				}
			}
		}
    });
    </script>
    
    <script type="text/javascript">
    function startday(){
		if(<%=startday%>){
		     return true;
		}
		else{
			alert("Start your day first!");
			return false;
		}	
	}
    </script>
    </head>
	<div class="header" id="header">
	  <div class="logo">
	  	<div style="float:right; padding-top:15px; padding-right:15px; color:white;height:56px; <%if(logged!=null){%>width:150px<%}%>">
		   <%if(logged==null){%>
		   <form action ="/loginsubmit" method="post">
			   <label for="identifier">Pseudo</label>
		       <input type="text" name="identifier" required="required"/>
		       <label for="password">Password</label>
			   <input type="password" name="password" required="required"/>
			   <input id ="ryc" class="image-login" type="submit" value="Login"/>
		   </form>	
		   <%}%>
		   <%if(logged!=null){%>
		   <div style="margin-right:5px; float:left; padding-top:10px; padding-right:3px;"><div <%if(startday){%>class="logged"<%}%><%if(!startday){%>class="notlogged"<%}%>></div></div>
		   	<form action ="/logout" method="post">
		   		<%=(String)session.getAttribute("PSEUDO")%>
		   		<input type="submit" value="logout">
		   	</form>	
		   <%}%>
		</div>
	  </div>
	</div>
	<body onload="init();">